package com.net.shop.car.manager.ui.html;

import android.content.Context;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView;

import com.net.shop.car.manager.R;
import com.net.shop.car.manager.ui.FullScreenDialog;

public class WebviewDialog extends FullScreenDialog {

	/**
	 * 标题
	 */
	private String title;

	/**
	 * 地址
	 */
	private String url;

	/**
	 * 网页视图控件
	 */
	private WebView webView;

	public WebviewDialog(Context context, String title) {
		super(context, R.style.Dialog_Fullscreen);
		this.title = title;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dialog_webview);

		initTitle(findViewById(R.id.webview_title), title == null ? "" : title);
		webView = (WebView) findViewById(R.id.webview_content);
		WebSettings settings = webView.getSettings();
//		settings.setUseWideViewPort(true);
//		settings.setLoadWithOverviewMode(true);
		settings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN); 
		webView.loadUrl(url);
	}

	/**
	 * @param url
	 *            String
	 */
	public void setUrl(String url) {
		this.url = url;
	}
}
